#ifndef EXCEPTION_H
#define EXCEPTION_H

#include "../global.h"

#define __construct( ClassName ) \
    ClassName() {Exception::_init("",0);};\
    ClassName(const string &msg, const int code){Exception::_init(msg,code);};\
    ClassName(const string &msg) {Exception::_init(msg,0);}\
    ClassName(const char*msg , const int code){string str(msg,strlen(msg));Exception::_init(str,code);}

namespace ZY {

    class Exception
    {
        public:
            __construct( Exception );

            string &getMessage() {return m_msg;}
            int getCode() {return m_code;}
            string &getTracString() {return m_trac;}

            virtual ~Exception();
        protected:
            void _init(const string &msg, const int code);

        private:
            string m_msg;
            int m_code;
            string m_trac;
//            size_t _calltrac( char *buff );


    };
}
#endif // EXCEPTION_H
